﻿#ifndef __SS_ACTOR_H__
#define __SS_ACTOR_H__
#include "message/ssMsgIdDef.h"
#include "container/ssList.h"
#include "thread/threadLock/ssAtomicLock.h"


namespace StarSeeker
{

class ssActor
{
	friend class ssActorThread;
	friend class ssActorMgr;
public:
	ssActor();
	virtual ~ssActor();
	//传入一个消息
	void PushMsg(ssMsg_s &m);
	//获取一个消息
	bool PopMsg(ssMsg_s &m);
	//消息个数
	ulint GetMsgCount();
	//返回ID
	u32 GetID();
	//返回状态
	bool IsWorking();
	//处理消息
	virtual void HandleMsg(ssMsg_s &m) = 0;
protected:
	u32					m_id;			//编号
	ssAtomic<long>		m_enabled;		//是否启用
	ssAtomic<long>		m_working;		//是否在被使用
	ssList<ssMsg_s>		m_msgList;		//消息队列
	ssAtomicLock		m_msgLock;
};

}
#endif
